package peopledetectservice

import (
	"encoding/base64"
	"gcc/global"
	"gocv.io/x/gocv"
	"sync"
)

type Detection struct{

}

type patchEntry struct{
	ServiceName  global.ServiceName
	ServiceURL  global.Address
}

type patch struct{
	Add []patchEntry `json:"add"`
	Removed []patchEntry `json:"removed"`
}

type ServiceDependencyMapping struct{
	mutex *sync.Mutex
	nameUrlMap map[global.ServiceName][]string
}

type Registration struct{
	ServiceName global.ServiceName // 服务名称是什么
	ServiceURL string		// 服务的URL是什么(一个服务可能有多个地址，也就是多个服务器进行服务)
	RequireService []global.ServiceName	//你这个服务需要基于你什么服务
	HeartService string		// 发送心跳的地址应该是本服务的地址
	RequiredUpdateService string // 需要的服务变化的通知
}

var Reg = Registration{
	ServiceName: global.PeopleDetectService,
	ServiceURL: string(global.PeopleDetectAddress),
	RequireService: []global.ServiceName{},
	HeartService: string(global.PeopleDetectAddress)+"/heart",
	RequiredUpdateService: string(global.PeopleDetectAddress)+"/service",
}

type Photo struct{
	Base64String string `json:"base64string`
}

var encode  = base64.Encoding{}

var meanF = gocv.NewMatWithSizesWithScalar([]int{320,320}, gocv.MatTypeCV8U, gocv.Scalar{0.485,0.485,0.485,0})
var meanS = gocv.NewMatWithSizesWithScalar([]int{320,320}, gocv.MatTypeCV8U, gocv.Scalar{0.456,0.456,0.456,0})
var meanT = gocv.NewMatWithSizesWithScalar([]int{320,320}, gocv.MatTypeCV8U, gocv.Scalar{0.406,0.406,0.406,0})
var stdF = gocv.NewMatWithSizesWithScalar([]int{320,320}, gocv.MatTypeCV8U, gocv.Scalar{0.229,0.229,0.229,0})
var stdS = gocv.NewMatWithSizesWithScalar([]int{320,320}, gocv.MatTypeCV8U, gocv.Scalar{0.224,0.224,0.224,0})
var stdT = gocv.NewMatWithSizesWithScalar([]int{320,320}, gocv.MatTypeCV8U, gocv.Scalar{0.225,0.225,0.225,0})


var Means = []gocv.Mat{
	meanF,
	meanS,
	meanT,
}
var Stds = []gocv.Mat{
	stdF,
	stdS,
	stdT,
}